package day05;
import java.util.Scanner;
import java.util.Arrays;
public class Test {
    public static void main(String[] args) {
        //1.Addition随机加法运算器
        /*int score = 0;
        Scanner scan = new Scanner(System.in);
        for(int i = 1;i<=10;i++){
            int a = (int)(Math.random()*100);
            int b = (int)(Math.random()*100);
            int result = a+b;
            System.out.println("("+i+")"+a+"+"+b+"=");
            System.out.println("请答题：");
            int answer = scan.nextInt();
            if(result == answer){
                System.out.println("答对了");
                score +=10;
            }else {
                System.out.println("答错了");
            }
        }
                System.out.println("总分："+score);*/
        //2.MultiTable九九乘法表
        /*for(int num = 1;num<=9;num++){
            for(int i = 1;i<=num;i++){
                System.out.print(i+"*9="+i*9+"\t");
            }
            System.out.println();
        }*/
        //3. 数组小代码练习：声明、初始化、访问、遍历
        /*int [] arr1 = new int[8];
        int [] arr2 = new int[]{1,2,3,4,5,6,7,8};
        int [] arr3 = {1,2,3,4,5,6,7,8};
        int [] arr4;
        //arr4 = {1,2,3}；
        arr4 = new int[]{1,2,3};
        arr4 [0] = 100;
        arr4 [1] = 200;
        arr4 [2] = 300;
        //arr4 [3] = 400;//ArrayIndexOutOfBoundsException
        System.out.println("arr[4]="+arr4 [2]);
        for(int i = 0;i<arr1.length;i++){
            System.out.println(arr1[i]);*/
        //4.MaxOfArray求数组元素最大值
        /*int [] arr = new int[5];
        int max = arr[0];
        for(int i = 0;i<arr.length;i++){
             arr[i] =(int)(Math.random()*100);
            System.out.println(arr[i]);
            if(arr[i]>max){
                max = arr[i];
            }
        }
        System.out.println("最大值为："+max);*/
        //5. 对数组进行升序排列，并输出排序后的结果
        /*int [] arr = new int[6];
        for(int i = 0;i<arr.length;i++){
           arr [i] = (int)(Math.random()*100);
        }
        Arrays.sort(arr);
        System.out.println("升序：");
        for(int i =0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("----------------");
        System.out.println("降序：");
        for(int i = arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }
        System.out.println("第一个元素是："+arr[0]);
*/
        //1. 利用for循环计算：求数字1到100之内，所有偶数的和，并输出
        /*int sum = 0;
        for(int i = 1;i<100;i++){
            if(i%2==0){
                System.out.println(i);
                sum += i;
            }
        }
        System.out.println("sum="+sum);
*/
        //2. 利用for循环计算：求8的阶乘，并输出
       /* int factorial = 1;
        for(int i =8;i>0;i--){
            System.out.println(i);
            factorial *= i;
        }
        System.out.println("8非阶乘为："+factorial);
        System.out.println(8*7*6*5*4*3*2*1);*/
        //3.
        /*for(int num = 1;num<=11;num+=2 ){
            for(int i = 1;i<=num;i++){
                    System.out.print("*");
            }
            System.out.println();
        }*/
        //4. 定义数组，包含10个元素，随机生成数据(范围自拟)，查找最大值和最小值，并输出
       /* int [] arr = new int[10];
        for(int i = 0;i<arr.length;i++){
            arr [i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
                int max = arr[0];
                for(int i = 1;i<arr.length;i++){
                    if(arr [i]>max){
                        max = arr[i];
                    }
                }
              System.out.println("最大值为："+max);
                int min = arr[0];
                for(int i = 1;i<arr.length;i++){
                    if(arr [i]<min){
                        min = arr [i];
                    }
                }
              System.out.println("最小值为："+min);*/
        for(int i =1;i<=6;i++){
            for(int k = 1;k<=2*i-1;k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
